import "package:ct_pa_majordomo/config/theme_vars.dart";
import "package:ct_pa_majordomo/pages/device/collect/dict.dart";
import "package:flutter/material.dart";


class ListItem extends StatelessWidget {
  final Map collect;

  const ListItem({
    super.key,
    required this.collect,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: const EdgeInsets.fromLTRB(12, 12, 16, 12),
      decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(8),
        boxShadow: const [ThemeVars.boxShadow],
        color: Colors.white,
      ),
      child: Row(
        children: [
          Expanded(
            child: Row(
              children: [
                Row(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Container(
                      padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
                      decoration: BoxDecoration(
                        borderRadius: BorderRadius.circular(10),
                        color: ThemeVars.colorPrimaryLight,
                      ),
                      child: const Text("采", style: TextStyle(fontSize: 20, color: ThemeVars.colorPrimary),),
                    )
                  ],
                ),
                const SizedBox(width: 8,),
                Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Text(collect["name"]),
                    const SizedBox(height: 4,),
                    Row(
                      children: [
                        Icon(Icons.link, color: CollectDict().collectColor[collect["online"]],),
                        const SizedBox(width: 2,),
                        Text(CollectDict().collectStatus[collect["online"]], style: const TextStyle(color: ThemeVars.colorTextTer),)
                      ],
                    )
                  ],
                )
              ],
            ),
          ),
          const Icon(
            Icons.arrow_forward_ios_rounded,
            size: 18,
            color: ThemeVars.colorTextSec,
          ),
        ],
      ),
    );
  }

}